<html>
<head><meta charset="utf-8"><title>Method resolution on raw pointers for primitive types · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Method.20resolution.20on.20raw.20pointers.20for.20primitive.20types.html">Method resolution on raw pointers for primitive types</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207966534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Method%20resolution%20on%20raw%20pointers%20for%20primitive%20types/near/207966534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BN <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Method.20resolution.20on.20raw.20pointers.20for.20primitive.20types.html#207966534">(Aug 25 2020 at 14:03)</a>:</h4>
<p>I'm interested in trying to fix <a href="https://github.com/rust-lang/rust/issues/74679">#74679</a>.  The method resolution algorithm seems to only consider trait bounds when inferring potential receiver types, but since CoerceUnsized is not implementable for primitive types such as slices and arrays, it currently seems to not be possible to get a coercion for raw pointers to primitive types during method resolution. <br>
<span class="user-mention" data-user-id="120791">@RalfJ</span> Do you maybe have any ideas for how this might be handled? I was thinking of a hacky solution, which would use try_coerce once all candidate checks in lookup_probe have failed, but I don't know how to get the inner type for the slice pointer in general.</p>



<a name="207972458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Method%20resolution%20on%20raw%20pointers%20for%20primitive%20types/near/207972458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Method.20resolution.20on.20raw.20pointers.20for.20primitive.20types.html#207972458">(Aug 25 2020 at 14:49)</a>:</h4>
<p><span class="user-mention" data-user-id="328097">@BN</span>  I'm afraid I am entirely unfamiliar with that part of the compiler.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>